# coding=utf-8
"""
author: jamon
"""
from typing import Dict
from pygame.sprite import Group
from package.static.const import TypeIdConst


class EntityManager(object):

    def __init__(self):
        # 中立静态实体
        self.screen_entities: Dict[TypeIdConst, Group] = {
            TypeIdConst.ENTITY_BRICK_WALL: Group(),
            TypeIdConst.ENTITY_BORDER_WALL: Group(),
            TypeIdConst.ENTITY_IRON_WALL: Group(),
            TypeIdConst.ENTITY_HOME: Group(),
            TypeIdConst.ENTITY_ICE: Group(),
            TypeIdConst.ENTITY_TREE: Group(),
            TypeIdConst.ENTITY_RIVER: Group(),
        }

        # 坦克实体
        self.our_tanks: Group = Group()
        self.npc_tanks: Group = Group()

        # 子弹实体
        self.our_bullets: Group = Group()
        self.npc_bullets: Group = Group()

        self.skills: Group = Group()

    def clear(self):
        for _, group in self.screen_entities.items():
            group.empty()

        # 坦克实体
        self.our_tanks.empty()
        self.npc_tanks.empty()

        # 子弹实体
        self.our_bullets.empty()
        self.npc_bullets.empty()

        self.skills.empty()


entity_mgr = EntityManager()
